<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib uri="/WEB-INF/tlds/authorizetag.tld" prefix="px"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>门店操作</title>
<link href="/admin/public/bootstrap.min.css" title="" rel="stylesheet" />
<link href="/admin/font-awesome/css/font-awesome.min.css"
	rel="stylesheet">
<link href="/admin/public/animate.css" rel="stylesheet">
<link rel="stylesheet" href="/admin/public/inspinia.css" />
<link rel="stylesheet" href="/admin/css/pop-up.css" />
<link rel="stylesheet" href="/admin/css/plugins/toastr/toastr.min.css" />
<link rel="stylesheet" type="text/css"
	href="${request.getContext }/admin/css/xcConfirm.css" />
<!-- 高德地图 -->
<link rel="stylesheet"
	href="http://cache.amap.com/lbs/static/main1119.css" />
<!-- 本地 -->
<script type="text/javascript"
	src="http://webapi.amap.com/maps?v=1.3&key=064fca579fe2d6c213c9c416d17b0a60&plugin=AMap.Autocomplete"></script>


<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
	<script src="/admin/public/html5shiv.min.js"></script>
	<script src="/admin/public/respond.min.js"></script>
<![endif]-->
<style type="text/css">
.img{
	height: 130px;
	width:180px;
}
</style>
</head>
<body>
	<div id="wrapper" class="container">
		<div class="wrapper wrapper-content">
			<div class="right_box">
				<div style="border: none; box-shadow: none;" class="right_one row">
					<div class="col-md-12 col-sm-12 col-xs-12" style="float: left;">
						<!-- 添加 -->
						<form class="form-horizontal" method="post" id="addClient"
							novalidate="novalidate" enctype="multipart/form-data">
							<div class="form-group">
								<!-- 用户 -->
								<input type="hidden" value="${userId }" name="userId" id="userId"  />
								<label class="col-lg-2 control-label">卡片:</label>
								<div class="col-lg-6">
									<select id="cardIdAndTimer" name="cardIdAndTimer" class="select2_demo_1 form-control">
										<c:forEach items="${list }" var="item">
											<option value="${item.cardId },${item.timer}">
											${item.cardName }(
												<c:if test="${item.cardTypeId eq 1}">月卡</c:if>
												<c:if test="${item.cardTypeId eq 2}">私教卡</c:if>
											)
											</option>
										</c:forEach>
									</select>
								</div>
							</div>
							<input type="hidden" id="checkTF" value="0">
								<px:authorize setting="会员-添加用户卡片">
								<input type="button" onclick="add(${userId });" style="display: none;"
									id="tijiao" value="添加" />
								</px:authorize>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
	<script src="/admin/public/jquery-1.11.3.js"></script>
	<script src="/admin/public/bootstrap.min.js" type="text/javascript"></script>
	<script src="${request.getContext }/admin/js/xcConfirm.js"
		type="text/javascript" charset="utf-8"></script>
	<script src="/admin/js/plugins/toastr/toastr.min.js"></script>
	<script src="/admin/js/new_page.js"></script>
	<script type="text/javascript">
		function check() {
			var cardIdAndTimer = $("#cardIdAndTimer").val();
			if (cardIdAndTimer == null || cardIdAndTimer == '') {
				alert("请选择卡片！");
				return false;
			}
			return true;

		}
		//添加门店
		function add(userId ) {
			if (check()) { 
				$("#checkTF").val("1");
				$.ajax({
			        type:"post",
			        data:$("#addClient").serialize(),
			        dataType:"json",
			        url:"/admin/Member/addUserCard",
			        success:function(data){
			        	if (data.success) {
							alertNew(data.msg, true);
							window.parent.location.href="/admin/Member/selKaPian?userId="+userId;
						}
			        	//window.location.href="/admin/Member/selKaPian?userId="+userId;
		    /* 			window.wxc.xcConfirm(data.msg, window.wxc.xcConfirm.typeEnum.confirm,{onOk:function(){ 
		    				window.parent.location.href="/admin/Member/selKaPian?userId="+userId;
		    	  		}}) */
			        },
			        error:function(data){
			        	alert("添加失败！");
			        }
			    });
				
			}
		}
	</script>

</body>
</html>
